/*
 * Copyright (c) 2023 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *         http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#include "awm_m11p_memory.h"
#include "mc/log.h"

namespace dev {

// 实现memory的虚函数
bool awm_m11p_memory::start() {
    return true;
}

// 实现memory的虚函数
bool awm_m11p_memory::stop() {
    return true;
}

// 实现memory的虚函数
bool awm_m11p_memory::init(mc::mutable_dict& config, const mc::dict& connector) {
    try {
        from_variant(config, *this);
    } catch (const std::exception& e) {
        elog("awm_m11p_memory init failed, exception: ${exception}", ("exception", e.what()));
        return false;
    }
    return true;
}

bool awm_m11p_memory::reset_default_properties() {
    m_memory.Manufacturer            = "";
    m_memory.PartNumber              = "";
    m_memory.Utilization             = 0;
    m_memory.DoubleBitErrorPageCount = 0;
    m_memory.SingleBitErrorPageCount = 0;

    return true;
}

} // namespace dev

MC_REFLECT(dev::awm_m11p_memory, ((m_memory, "bmc.dev.Memory")))